package com.google.android.exoplayer2.trackselection;

import android.graphics.Point;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.Parcelable.Creator;
import android.text.TextUtils;
import android.util.Pair;
import android.util.SparseArray;
import android.util.SparseBooleanArray;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.ActivityChooserView.ActivityChooserViewAdapter;
import com.google.android.exoplayer2.ExoPlaybackException;
import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.source.TrackGroup;
import com.google.android.exoplayer2.source.TrackGroupArray;
import com.huawei.appgallery.festivalanimation.particle.modifiers.SizeModifier;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.atomic.AtomicReference;
import o.abs;
import o.aks;
import o.akv;
import o.akz;
import o.ald;
import o.amm;
import o.anr;

public class DefaultTrackSelector extends aks {
    private static final int[] ˋ = new int[0];
    private final o.akz.a ˊ;
    private final AtomicReference<Parameters> ॱ;

    public static final class Parameters implements Parcelable {
        public static final Creator<Parameters> CREATOR = new Creator<Parameters>() {
            public /* synthetic */ Object createFromParcel(Parcel parcel) {
                return ˏ(parcel);
            }

            public /* synthetic */ Object[] newArray(int i) {
                return ॱ(i);
            }

            public Parameters ˏ(Parcel parcel) {
                return new Parameters(parcel);
            }

            public Parameters[] ॱ(int i) {
                return new Parameters[i];
            }
        };
        public static final Parameters ˋ = new Parameters();
        public final int ʻ;
        public final int ʻॱ;
        public final int ʼ;
        public final boolean ʽ;
        private final SparseBooleanArray ʾ;
        public final boolean ˊ;
        public final boolean ˊॱ;
        public final int ˋॱ;
        public final int ˎ;
        @Nullable
        public final String ˏ;
        public final boolean ˏॱ;
        public final boolean ͺ;
        @Nullable
        public final String ॱ;
        public final int ॱˊ;
        private final SparseArray<Map<TrackGroupArray, SelectionOverride>> ॱˋ;
        public final boolean ॱˎ;
        public final int ॱॱ;
        public final boolean ॱᐝ;
        public final int ᐝ;
        public final boolean ᐝॱ;

        private Parameters() {
            this(new SparseArray(), new SparseBooleanArray(), null, null, false, 0, false, false, false, true, ActivityChooserViewAdapter.MAX_ACTIVITY_COUNT_UNLIMITED, ActivityChooserViewAdapter.MAX_ACTIVITY_COUNT_UNLIMITED, ActivityChooserViewAdapter.MAX_ACTIVITY_COUNT_UNLIMITED, ActivityChooserViewAdapter.MAX_ACTIVITY_COUNT_UNLIMITED, true, true, ActivityChooserViewAdapter.MAX_ACTIVITY_COUNT_UNLIMITED, ActivityChooserViewAdapter.MAX_ACTIVITY_COUNT_UNLIMITED, true, 0);
        }

        Parameters(SparseArray<Map<TrackGroupArray, SelectionOverride>> sparseArray, SparseBooleanArray sparseBooleanArray, @Nullable String str, @Nullable String str2, boolean z, int i, boolean z2, boolean z3, boolean z4, boolean z5, int i2, int i3, int i4, int i5, boolean z6, boolean z7, int i6, int i7, boolean z8, int i8) {
            this.ॱˋ = sparseArray;
            this.ʾ = sparseBooleanArray;
            this.ॱ = anr.ˋ(str);
            this.ˏ = anr.ˋ(str2);
            this.ˊ = z;
            this.ˎ = i;
            this.ͺ = z2;
            this.ˊॱ = z3;
            this.ॱˎ = z4;
            this.ॱᐝ = z5;
            this.ʻ = i2;
            this.ᐝ = i3;
            this.ʼ = i4;
            this.ॱॱ = i5;
            this.ʽ = z6;
            this.ᐝॱ = z7;
            this.ˋॱ = i6;
            this.ॱˊ = i7;
            this.ˏॱ = z8;
            this.ʻॱ = i8;
        }

        Parameters(Parcel parcel) {
            this.ॱˋ = ॱ(parcel);
            this.ʾ = parcel.readSparseBooleanArray();
            this.ॱ = parcel.readString();
            this.ˏ = parcel.readString();
            this.ˊ = anr.ˋ(parcel);
            this.ˎ = parcel.readInt();
            this.ͺ = anr.ˋ(parcel);
            this.ˊॱ = anr.ˋ(parcel);
            this.ॱˎ = anr.ˋ(parcel);
            this.ॱᐝ = anr.ˋ(parcel);
            this.ʻ = parcel.readInt();
            this.ᐝ = parcel.readInt();
            this.ʼ = parcel.readInt();
            this.ॱॱ = parcel.readInt();
            this.ʽ = anr.ˋ(parcel);
            this.ᐝॱ = anr.ˋ(parcel);
            this.ˋॱ = parcel.readInt();
            this.ॱˊ = parcel.readInt();
            this.ˏॱ = anr.ˋ(parcel);
            this.ʻॱ = parcel.readInt();
        }

        public final boolean ॱ(int i) {
            return this.ʾ.get(i);
        }

        public final boolean ॱ(int i, TrackGroupArray trackGroupArray) {
            Map map = (Map) this.ॱˋ.get(i);
            return map != null && map.containsKey(trackGroupArray);
        }

        @Nullable
        public final SelectionOverride ˎ(int i, TrackGroupArray trackGroupArray) {
            Map map = (Map) this.ॱˋ.get(i);
            return map != null ? (SelectionOverride) map.get(trackGroupArray) : null;
        }

        public boolean equals(@Nullable Object obj) {
            if (this == obj) {
                return true;
            }
            if (obj == null || getClass() != obj.getClass()) {
                return false;
            }
            Parameters parameters = (Parameters) obj;
            if (this.ˊ == parameters.ˊ && this.ˎ == parameters.ˎ && this.ͺ == parameters.ͺ && this.ˊॱ == parameters.ˊॱ && this.ॱˎ == parameters.ॱˎ && this.ॱᐝ == parameters.ॱᐝ && this.ʻ == parameters.ʻ && this.ᐝ == parameters.ᐝ && this.ʼ == parameters.ʼ && this.ʽ == parameters.ʽ && this.ᐝॱ == parameters.ᐝॱ && this.ˏॱ == parameters.ˏॱ && this.ˋॱ == parameters.ˋॱ && this.ॱˊ == parameters.ॱˊ && this.ॱॱ == parameters.ॱॱ && this.ʻॱ == parameters.ʻॱ && TextUtils.equals(this.ॱ, parameters.ॱ) && TextUtils.equals(this.ˏ, parameters.ˏ) && ˎ(this.ʾ, parameters.ʾ) && ˏ(this.ॱˋ, parameters.ॱˋ)) {
                return true;
            }
            return false;
        }

        public int hashCode() {
            int i;
            int i2 = 1;
            int i3 = 0;
            int i4 = (((this.ˊ ? 1 : 0) * 31) + this.ˎ) * 31;
            if (this.ͺ) {
                i = 1;
            } else {
                i = 0;
            }
            i4 = (i + i4) * 31;
            if (this.ˊॱ) {
                i = 1;
            } else {
                i = 0;
            }
            i4 = (i + i4) * 31;
            if (this.ॱˎ) {
                i = 1;
            } else {
                i = 0;
            }
            i4 = (i + i4) * 31;
            if (this.ॱᐝ) {
                i = 1;
            } else {
                i = 0;
            }
            i4 = (((((((i + i4) * 31) + this.ʻ) * 31) + this.ᐝ) * 31) + this.ʼ) * 31;
            if (this.ʽ) {
                i = 1;
            } else {
                i = 0;
            }
            i4 = (i + i4) * 31;
            if (this.ᐝॱ) {
                i = 1;
            } else {
                i = 0;
            }
            i = (i + i4) * 31;
            if (!this.ˏॱ) {
                i2 = 0;
            }
            i2 = (((((((((i + i2) * 31) + this.ˋॱ) * 31) + this.ॱˊ) * 31) + this.ॱॱ) * 31) + this.ʻॱ) * 31;
            if (this.ॱ == null) {
                i = 0;
            } else {
                i = this.ॱ.hashCode();
            }
            i = (i + i2) * 31;
            if (this.ˏ != null) {
                i3 = this.ˏ.hashCode();
            }
            return i + i3;
        }

        public int describeContents() {
            return 0;
        }

        public void writeToParcel(Parcel parcel, int i) {
            ˎ(parcel, this.ॱˋ);
            parcel.writeSparseBooleanArray(this.ʾ);
            parcel.writeString(this.ॱ);
            parcel.writeString(this.ˏ);
            anr.ˎ(parcel, this.ˊ);
            parcel.writeInt(this.ˎ);
            anr.ˎ(parcel, this.ͺ);
            anr.ˎ(parcel, this.ˊॱ);
            anr.ˎ(parcel, this.ॱˎ);
            anr.ˎ(parcel, this.ॱᐝ);
            parcel.writeInt(this.ʻ);
            parcel.writeInt(this.ᐝ);
            parcel.writeInt(this.ʼ);
            parcel.writeInt(this.ॱॱ);
            anr.ˎ(parcel, this.ʽ);
            anr.ˎ(parcel, this.ᐝॱ);
            parcel.writeInt(this.ˋॱ);
            parcel.writeInt(this.ॱˊ);
            anr.ˎ(parcel, this.ˏॱ);
            parcel.writeInt(this.ʻॱ);
        }

        private static SparseArray<Map<TrackGroupArray, SelectionOverride>> ॱ(Parcel parcel) {
            int readInt = parcel.readInt();
            SparseArray<Map<TrackGroupArray, SelectionOverride>> sparseArray = new SparseArray(readInt);
            for (int i = 0; i < readInt; i++) {
                int readInt2 = parcel.readInt();
                int readInt3 = parcel.readInt();
                Map hashMap = new HashMap(readInt3);
                for (int i2 = 0; i2 < readInt3; i2++) {
                    hashMap.put((TrackGroupArray) parcel.readParcelable(TrackGroupArray.class.getClassLoader()), (SelectionOverride) parcel.readParcelable(SelectionOverride.class.getClassLoader()));
                }
                sparseArray.put(readInt2, hashMap);
            }
            return sparseArray;
        }

        private static void ˎ(Parcel parcel, SparseArray<Map<TrackGroupArray, SelectionOverride>> sparseArray) {
            int size = sparseArray.size();
            parcel.writeInt(size);
            for (int i = 0; i < size; i++) {
                int keyAt = sparseArray.keyAt(i);
                Map map = (Map) sparseArray.valueAt(i);
                int size2 = map.size();
                parcel.writeInt(keyAt);
                parcel.writeInt(size2);
                for (Entry entry : map.entrySet()) {
                    parcel.writeParcelable((Parcelable) entry.getKey(), 0);
                    parcel.writeParcelable((Parcelable) entry.getValue(), 0);
                }
            }
        }

        private static boolean ˎ(SparseBooleanArray sparseBooleanArray, SparseBooleanArray sparseBooleanArray2) {
            int size = sparseBooleanArray.size();
            if (sparseBooleanArray2.size() != size) {
                return false;
            }
            for (int i = 0; i < size; i++) {
                if (sparseBooleanArray2.indexOfKey(sparseBooleanArray.keyAt(i)) < 0) {
                    return false;
                }
            }
            return true;
        }

        private static boolean ˏ(SparseArray<Map<TrackGroupArray, SelectionOverride>> sparseArray, SparseArray<Map<TrackGroupArray, SelectionOverride>> sparseArray2) {
            int size = sparseArray.size();
            if (sparseArray2.size() != size) {
                return false;
            }
            int i = 0;
            while (i < size) {
                int indexOfKey = sparseArray2.indexOfKey(sparseArray.keyAt(i));
                if (indexOfKey < 0 || !ˎ((Map) sparseArray.valueAt(i), (Map) sparseArray2.valueAt(indexOfKey))) {
                    return false;
                }
                i++;
            }
            return true;
        }

        private static boolean ˎ(Map<TrackGroupArray, SelectionOverride> map, Map<TrackGroupArray, SelectionOverride> map2) {
            if (map2.size() != map.size()) {
                return false;
            }
            for (Entry entry : map.entrySet()) {
                TrackGroupArray trackGroupArray = (TrackGroupArray) entry.getKey();
                if (map2.containsKey(trackGroupArray)) {
                    if (!anr.ˎ(entry.getValue(), map2.get(trackGroupArray))) {
                    }
                }
                return false;
            }
            return true;
        }
    }

    public static final class SelectionOverride implements Parcelable {
        public static final Creator<SelectionOverride> CREATOR = new Creator<SelectionOverride>() {
            public /* synthetic */ Object createFromParcel(Parcel parcel) {
                return ˏ(parcel);
            }

            public /* synthetic */ Object[] newArray(int i) {
                return ॱ(i);
            }

            public SelectionOverride ˏ(Parcel parcel) {
                return new SelectionOverride(parcel);
            }

            public SelectionOverride[] ॱ(int i) {
                return new SelectionOverride[i];
            }
        };
        public final int[] ˋ = new int[this.ˎ];
        public final int ˎ;
        public final int ˏ;

        SelectionOverride(Parcel parcel) {
            this.ˏ = parcel.readInt();
            this.ˎ = parcel.readByte();
            parcel.readIntArray(this.ˋ);
        }

        public int hashCode() {
            return (this.ˏ * 31) + Arrays.hashCode(this.ˋ);
        }

        public boolean equals(@Nullable Object obj) {
            if (this == obj) {
                return true;
            }
            if (obj == null || getClass() != obj.getClass()) {
                return false;
            }
            SelectionOverride selectionOverride = (SelectionOverride) obj;
            if (this.ˏ == selectionOverride.ˏ && Arrays.equals(this.ˋ, selectionOverride.ˋ)) {
                return true;
            }
            return false;
        }

        public int describeContents() {
            return 0;
        }

        public void writeToParcel(Parcel parcel, int i) {
            parcel.writeInt(this.ˏ);
            parcel.writeInt(this.ˋ.length);
            parcel.writeIntArray(this.ˋ);
        }
    }

    protected static final class a implements Comparable<a> {
        private final int ˊ;
        private final int ˋ;
        private final int ˎ;
        private final int ˏ;
        private final Parameters ॱ;
        private final int ॱॱ;
        private final int ᐝ;

        public /* synthetic */ int compareTo(@NonNull Object obj) {
            return ˋ((a) obj);
        }

        public a(Format format, Parameters parameters, int i) {
            int i2;
            int i3 = 1;
            this.ॱ = parameters;
            this.ˊ = DefaultTrackSelector.ˏ(i, false) ? 1 : 0;
            if (DefaultTrackSelector.ˋ(format, parameters.ॱ)) {
                i2 = 1;
            } else {
                i2 = 0;
            }
            this.ˏ = i2;
            if ((format.ʾ & 1) == 0) {
                i3 = 0;
            }
            this.ˋ = i3;
            this.ˎ = format.ॱˎ;
            this.ॱॱ = format.ʼॱ;
            this.ᐝ = format.ˏ;
        }

        public int ˋ(@NonNull a aVar) {
            int i = 1;
            if (this.ˊ != aVar.ˊ) {
                return DefaultTrackSelector.ˊ(this.ˊ, aVar.ˊ);
            }
            if (this.ˏ != aVar.ˏ) {
                return DefaultTrackSelector.ˊ(this.ˏ, aVar.ˏ);
            }
            if (this.ˋ != aVar.ˋ) {
                return DefaultTrackSelector.ˊ(this.ˋ, aVar.ˋ);
            }
            if (this.ॱ.ͺ) {
                return DefaultTrackSelector.ˊ(aVar.ᐝ, this.ᐝ);
            }
            if (this.ˊ != 1) {
                i = -1;
            }
            if (this.ˎ != aVar.ˎ) {
                return i * DefaultTrackSelector.ˊ(this.ˎ, aVar.ˎ);
            }
            if (this.ॱॱ != aVar.ॱॱ) {
                return i * DefaultTrackSelector.ˊ(this.ॱॱ, aVar.ॱॱ);
            }
            return i * DefaultTrackSelector.ˊ(this.ᐝ, aVar.ᐝ);
        }
    }

    static final class e {
        @Nullable
        public final String ˊ;
        public final int ˎ;
        public final int ॱ;

        public e(int i, int i2, @Nullable String str) {
            this.ˎ = i;
            this.ॱ = i2;
            this.ˊ = str;
        }

        public boolean equals(@Nullable Object obj) {
            if (this == obj) {
                return true;
            }
            if (obj == null || getClass() != obj.getClass()) {
                return false;
            }
            e eVar = (e) obj;
            if (this.ˎ == eVar.ˎ && this.ॱ == eVar.ॱ && TextUtils.equals(this.ˊ, eVar.ˊ)) {
                return true;
            }
            return false;
        }

        public int hashCode() {
            return (this.ˊ != null ? this.ˊ.hashCode() : 0) + (((this.ˎ * 31) + this.ॱ) * 31);
        }
    }

    public DefaultTrackSelector() {
        this(new o.akt.a());
    }

    public DefaultTrackSelector(o.akz.a aVar) {
        this.ˊ = aVar;
        this.ॱ = new AtomicReference(Parameters.ˋ);
    }

    public final Pair<abs[], akz[]> ˏ(o.aks.e eVar, int[][][] iArr, int[] iArr2) throws ExoPlaybackException {
        int i;
        Parameters parameters = (Parameters) this.ॱ.get();
        int ˊ = eVar.ˊ();
        Object ˊ2 = ˊ(eVar, iArr, iArr2, parameters);
        for (i = 0; i < ˊ; i++) {
            if (parameters.ॱ(i)) {
                ˊ2[i] = null;
            } else {
                TrackGroupArray ॱ = eVar.ॱ(i);
                if (parameters.ॱ(i, ॱ)) {
                    SelectionOverride ˎ = parameters.ˎ(i, ॱ);
                    if (ˎ == null) {
                        ˊ2[i] = null;
                    } else if (ˎ.ˎ == 1) {
                        ˊ2[i] = new akv(ॱ.ˋ(ˎ.ˏ), ˎ.ˋ[0]);
                    } else {
                        ˊ2[i] = ((o.akz.a) amm.ॱ(this.ˊ)).ˎ(ॱ.ˋ(ˎ.ˏ), ˎ(), ˎ.ˋ);
                    }
                }
            }
        }
        Object obj = new abs[ˊ];
        i = 0;
        while (i < ˊ) {
            int i2;
            abs o_abs;
            if (parameters.ॱ(i) || (eVar.ˏ(i) != 6 && ˊ2[i] == null)) {
                i2 = 0;
            } else {
                i2 = 1;
            }
            if (i2 != 0) {
                o_abs = abs.ˊ;
            } else {
                o_abs = null;
            }
            obj[i] = o_abs;
            i++;
        }
        ˊ(eVar, iArr, obj, ˊ2, parameters.ʻॱ);
        return Pair.create(obj, ˊ2);
    }

    /* JADX WARNING: inconsistent code. */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    protected o.akz[] ˊ(o.aks.e r16, int[][][] r17, int[] r18, com.google.android.exoplayer2.trackselection.DefaultTrackSelector.Parameters r19) throws com.google.android.exoplayer2.ExoPlaybackException {
        /*
        r15 = this;
        r13 = r16.ˊ();
        r14 = new o.akz[r13];
        r7 = 0;
        r2 = 0;
        r1 = 0;
        r8 = r1;
        r1 = r2;
    L_0x000b:
        if (r8 >= r13) goto L_0x0047;
    L_0x000d:
        r2 = 2;
        r0 = r16;
        r3 = r0.ˏ(r8);
        if (r2 != r3) goto L_0x00e6;
    L_0x0016:
        if (r1 != 0) goto L_0x0032;
    L_0x0018:
        r0 = r16;
        r2 = r0.ॱ(r8);
        r3 = r17[r8];
        r4 = r18[r8];
        r6 = r15.ˊ;
        r1 = r15;
        r5 = r19;
        r1 = r1.ॱ(r2, r3, r4, r5, r6);
        r14[r8] = r1;
        r1 = r14[r8];
        if (r1 == 0) goto L_0x0043;
    L_0x0031:
        r1 = 1;
    L_0x0032:
        r0 = r16;
        r2 = r0.ॱ(r8);
        r2 = r2.ॱ;
        if (r2 <= 0) goto L_0x0045;
    L_0x003c:
        r2 = 1;
    L_0x003d:
        r2 = r2 | r7;
    L_0x003e:
        r3 = r8 + 1;
        r8 = r3;
        r7 = r2;
        goto L_0x000b;
    L_0x0043:
        r1 = 0;
        goto L_0x0032;
    L_0x0045:
        r2 = 0;
        goto L_0x003d;
    L_0x0047:
        r12 = 0;
        r11 = -1;
        r10 = -2147483648; // 0xffffffff80000000 float:-0.0 double:NaN;
        r8 = -1;
        r9 = 0;
    L_0x004d:
        if (r9 >= r13) goto L_0x00e5;
    L_0x004f:
        r0 = r16;
        r1 = r0.ˏ(r9);
        switch(r1) {
            case 1: goto L_0x0078;
            case 2: goto L_0x0073;
            case 3: goto L_0x00b2;
            default: goto L_0x0058;
        };
    L_0x0058:
        r0 = r16;
        r2 = r0.ॱ(r9);
        r3 = r17[r9];
        r0 = r19;
        r1 = r15.ॱ(r1, r2, r3, r0);
        r14[r9] = r1;
    L_0x0068:
        r1 = r8;
        r2 = r10;
        r3 = r11;
        r4 = r12;
    L_0x006c:
        r9 = r9 + 1;
        r8 = r1;
        r10 = r2;
        r11 = r3;
        r12 = r4;
        goto L_0x004d;
    L_0x0073:
        r1 = r8;
        r2 = r10;
        r3 = r11;
        r4 = r12;
        goto L_0x006c;
    L_0x0078:
        r0 = r16;
        r2 = r0.ॱ(r9);
        r3 = r17[r9];
        r4 = r18[r9];
        if (r7 == 0) goto L_0x00af;
    L_0x0084:
        r6 = 0;
    L_0x0085:
        r1 = r15;
        r5 = r19;
        r2 = r1.ˎ(r2, r3, r4, r5, r6);
        if (r2 == 0) goto L_0x0068;
    L_0x008e:
        if (r12 == 0) goto L_0x009a;
    L_0x0090:
        r1 = r2.second;
        r1 = (com.google.android.exoplayer2.trackselection.DefaultTrackSelector.a) r1;
        r1 = r1.ˋ(r12);
        if (r1 <= 0) goto L_0x0068;
    L_0x009a:
        r1 = -1;
        if (r11 == r1) goto L_0x00a0;
    L_0x009d:
        r1 = 0;
        r14[r11] = r1;
    L_0x00a0:
        r1 = r2.first;
        r1 = (o.akz) r1;
        r14[r9] = r1;
        r1 = r2.second;
        r1 = (com.google.android.exoplayer2.trackselection.DefaultTrackSelector.a) r1;
        r2 = r10;
        r3 = r9;
        r4 = r1;
        r1 = r8;
        goto L_0x006c;
    L_0x00af:
        r6 = r15.ˊ;
        goto L_0x0085;
    L_0x00b2:
        r0 = r16;
        r1 = r0.ॱ(r9);
        r2 = r17[r9];
        r0 = r19;
        r2 = r15.ˋ(r1, r2, r0);
        if (r2 == 0) goto L_0x0068;
    L_0x00c2:
        r1 = r2.second;
        r1 = (java.lang.Integer) r1;
        r1 = r1.intValue();
        if (r1 <= r10) goto L_0x0068;
    L_0x00cc:
        r1 = -1;
        if (r8 == r1) goto L_0x00d2;
    L_0x00cf:
        r1 = 0;
        r14[r8] = r1;
    L_0x00d2:
        r1 = r2.first;
        r1 = (o.akz) r1;
        r14[r9] = r1;
        r1 = r2.second;
        r1 = (java.lang.Integer) r1;
        r1 = r1.intValue();
        r2 = r1;
        r3 = r11;
        r4 = r12;
        r1 = r9;
        goto L_0x006c;
    L_0x00e5:
        return r14;
    L_0x00e6:
        r2 = r7;
        goto L_0x003e;
        */
        throw new UnsupportedOperationException("Method not decompiled: com.google.android.exoplayer2.trackselection.DefaultTrackSelector.ˊ(o.aks$e, int[][][], int[], com.google.android.exoplayer2.trackselection.DefaultTrackSelector$Parameters):o.akz[]");
    }

    @Nullable
    protected akz ॱ(TrackGroupArray trackGroupArray, int[][] iArr, int i, Parameters parameters, @Nullable o.akz.a aVar) throws ExoPlaybackException {
        akz o_akz = null;
        if (!(parameters.ˊॱ || parameters.ͺ || aVar == null)) {
            o_akz = ˏ(trackGroupArray, iArr, i, parameters, aVar, ˎ());
        }
        if (o_akz == null) {
            return ॱ(trackGroupArray, iArr, parameters);
        }
        return o_akz;
    }

    @Nullable
    private static akz ˏ(TrackGroupArray trackGroupArray, int[][] iArr, int i, Parameters parameters, o.akz.a aVar, ald o_ald) throws ExoPlaybackException {
        int i2 = parameters.ॱᐝ ? 24 : 16;
        boolean z = parameters.ॱˎ && (i & i2) != 0;
        for (int i3 = 0; i3 < trackGroupArray.ॱ; i3++) {
            TrackGroup ˋ = trackGroupArray.ˋ(i3);
            int[] ॱ = ॱ(ˋ, iArr[i3], z, i2, parameters.ʻ, parameters.ᐝ, parameters.ʼ, parameters.ॱॱ, parameters.ˋॱ, parameters.ॱˊ, parameters.ˏॱ);
            if (ॱ.length > 0) {
                return ((o.akz.a) amm.ॱ(aVar)).ˎ(ˋ, o_ald, ॱ);
            }
        }
        return null;
    }

    private static int[] ॱ(TrackGroup trackGroup, int[] iArr, boolean z, int i, int i2, int i3, int i4, int i5, int i6, int i7, boolean z2) {
        if (trackGroup.ॱ < 2) {
            return ˋ;
        }
        List ॱ = ॱ(trackGroup, i6, i7, z2);
        if (ॱ.size() < 2) {
            return ˋ;
        }
        String str;
        String str2 = null;
        if (z) {
            str = null;
        } else {
            HashSet hashSet = new HashSet();
            int i8 = 0;
            int i9 = 0;
            while (i9 < ॱ.size()) {
                int ˋ;
                str = trackGroup.ˊ(((Integer) ॱ.get(i9)).intValue()).ʽ;
                if (hashSet.add(str)) {
                    ˋ = ˋ(trackGroup, iArr, i, str, i2, i3, i4, i5, ॱ);
                    if (ˋ > i8) {
                        i9++;
                        i8 = ˋ;
                        str2 = str;
                    }
                }
                ˋ = i8;
                str = str2;
                i9++;
                i8 = ˋ;
                str2 = str;
            }
            str = str2;
        }
        ˊ(trackGroup, iArr, i, str, i2, i3, i4, i5, ॱ);
        return ॱ.size() < 2 ? ˋ : anr.ˎ(ॱ);
    }

    private static int ˋ(TrackGroup trackGroup, int[] iArr, int i, @Nullable String str, int i2, int i3, int i4, int i5, List<Integer> list) {
        int i6 = 0;
        int i7 = 0;
        while (i6 < list.size()) {
            int intValue = ((Integer) list.get(i6)).intValue();
            if (ॱ(trackGroup.ˊ(intValue), str, iArr[intValue], i, i2, i3, i4, i5)) {
                intValue = i7 + 1;
            } else {
                intValue = i7;
            }
            i6++;
            i7 = intValue;
        }
        return i7;
    }

    private static void ˊ(TrackGroup trackGroup, int[] iArr, int i, @Nullable String str, int i2, int i3, int i4, int i5, List<Integer> list) {
        for (int size = list.size() - 1; size >= 0; size--) {
            int intValue = ((Integer) list.get(size)).intValue();
            if (!ॱ(trackGroup.ˊ(intValue), str, iArr[intValue], i, i2, i3, i4, i5)) {
                list.remove(size);
            }
        }
    }

    private static boolean ॱ(Format format, @Nullable String str, int i, int i2, int i3, int i4, int i5, int i6) {
        if (!ˏ(i, false) || (i & i2) == 0) {
            return false;
        }
        if (str != null && !anr.ˎ(format.ʽ, (Object) str)) {
            return false;
        }
        if (format.ͺ != -1 && format.ͺ > i3) {
            return false;
        }
        if (format.ˏॱ != -1 && format.ˏॱ > i4) {
            return false;
        }
        if (format.ॱˊ != SizeModifier.STABLE_STATE_SCALE && format.ॱˊ > ((float) i5)) {
            return false;
        }
        if (format.ˏ == -1 || format.ˏ <= i6) {
            return true;
        }
        return false;
    }

    @Nullable
    private static akz ॱ(TrackGroupArray trackGroupArray, int[][] iArr, Parameters parameters) {
        TrackGroup trackGroup = null;
        int i = 0;
        int i2 = -1;
        int i3 = -1;
        int i4 = 0;
        for (int i5 = 0; i5 < trackGroupArray.ॱ; i5++) {
            TrackGroup ˋ = trackGroupArray.ˋ(i5);
            List ॱ = ॱ(ˋ, parameters.ˋॱ, parameters.ॱˊ, parameters.ˏॱ);
            int[] iArr2 = iArr[i5];
            int i6 = 0;
            while (i6 < ˋ.ॱ) {
                int i7;
                TrackGroup trackGroup2;
                if (ˏ(iArr2[i6], parameters.ᐝॱ)) {
                    Object obj;
                    Format ˊ = ˋ.ˊ(i6);
                    if (!ॱ.contains(Integer.valueOf(i6)) || ((ˊ.ͺ != -1 && ˊ.ͺ > parameters.ʻ) || ((ˊ.ˏॱ != -1 && ˊ.ˏॱ > parameters.ᐝ) || ((ˊ.ॱˊ != SizeModifier.STABLE_STATE_SCALE && ˊ.ॱˊ > ((float) parameters.ʼ)) || (ˊ.ˏ != -1 && ˊ.ˏ > parameters.ॱॱ))))) {
                        obj = null;
                    } else {
                        obj = 1;
                    }
                    if (obj != null || parameters.ʽ) {
                        i7 = obj != null ? 2 : 1;
                        boolean ˏ = ˏ(iArr2[i6], false);
                        if (ˏ) {
                            i7 += 1000;
                        }
                        Object obj2 = i7 > i4 ? 1 : null;
                        if (i7 == i4) {
                            if (parameters.ͺ) {
                                obj2 = ˎ(ˊ.ˏ, i3) < 0 ? 1 : null;
                            } else {
                                int ˊ2 = ˊ.ˊ();
                                if (ˊ2 != i2) {
                                    ˊ2 = ˎ(ˊ2, i2);
                                } else {
                                    ˊ2 = ˎ(ˊ.ˏ, i3);
                                }
                                obj2 = (!ˏ || obj == null) ? ˊ2 < 0 ? 1 : null : ˊ2 > 0 ? 1 : null;
                            }
                        }
                        if (obj2 != null) {
                            i3 = ˊ.ˏ;
                            i2 = ˊ.ˊ();
                            i4 = i7;
                            trackGroup2 = ˋ;
                            i7 = i6;
                            i6++;
                            trackGroup = trackGroup2;
                            i = i7;
                        }
                    } else {
                        i7 = i;
                        trackGroup2 = trackGroup;
                        i6++;
                        trackGroup = trackGroup2;
                        i = i7;
                    }
                }
                i7 = i;
                trackGroup2 = trackGroup;
                i6++;
                trackGroup = trackGroup2;
                i = i7;
            }
        }
        return trackGroup == null ? null : new akv(trackGroup, i);
    }

    @Nullable
    protected Pair<akz, a> ˎ(TrackGroupArray trackGroupArray, int[][] iArr, int i, Parameters parameters, @Nullable o.akz.a aVar) throws ExoPlaybackException {
        int i2 = -1;
        int i3 = -1;
        Object obj = null;
        for (int i4 = 0; i4 < trackGroupArray.ॱ; i4++) {
            TrackGroup ˋ = trackGroupArray.ˋ(i4);
            int[] iArr2 = iArr[i4];
            int i5 = 0;
            while (i5 < ˋ.ॱ) {
                int i6;
                if (ˏ(iArr2[i5], parameters.ᐝॱ)) {
                    a aVar2 = new a(ˋ.ˊ(i5), parameters, iArr2[i5]);
                    if (obj == null || aVar2.ˋ(obj) > 0) {
                        obj = aVar2;
                        i3 = i5;
                        i6 = i4;
                        i5++;
                        i2 = i3;
                        i3 = i6;
                    }
                }
                i6 = i3;
                i3 = i2;
                i5++;
                i2 = i3;
                i3 = i6;
            }
        }
        if (i3 == -1) {
            return null;
        }
        TrackGroup ˋ2 = trackGroupArray.ˋ(i3);
        Object obj2 = null;
        if (!(parameters.ˊॱ || parameters.ͺ || aVar == null)) {
            int[] ˎ = ˎ(ˋ2, iArr[i3], parameters.ॱˎ);
            if (ˎ.length > 0) {
                obj2 = aVar.ˎ(ˋ2, ˎ(), ˎ);
            }
        }
        if (obj2 == null) {
            obj2 = new akv(ˋ2, i2);
        }
        return Pair.create(obj2, amm.ॱ(obj));
    }

    private static int[] ˎ(TrackGroup trackGroup, int[] iArr, boolean z) {
        int ˋ;
        int i = 0;
        HashSet hashSet = new HashSet();
        int i2 = 0;
        e eVar = null;
        int i3 = 0;
        while (i2 < trackGroup.ॱ) {
            int i4;
            Format ˊ = trackGroup.ˊ(i2);
            e eVar2 = new e(ˊ.ॱˎ, ˊ.ʼॱ, z ? null : ˊ.ʽ);
            if (hashSet.add(eVar2)) {
                ˋ = ˋ(trackGroup, iArr, eVar2);
                if (ˋ > i3) {
                    i4 = ˋ;
                    i2++;
                    i3 = i4;
                    eVar = eVar2;
                }
            }
            eVar2 = eVar;
            i4 = i3;
            i2++;
            i3 = i4;
            eVar = eVar2;
        }
        if (i3 <= 1) {
            return ˋ;
        }
        int[] iArr2 = new int[i3];
        ˋ = 0;
        while (i < trackGroup.ॱ) {
            int i5;
            if (ˊ(trackGroup.ˊ(i), iArr[i], (e) amm.ॱ(eVar))) {
                i5 = ˋ + 1;
                iArr2[ˋ] = i;
            } else {
                i5 = ˋ;
            }
            i++;
            ˋ = i5;
        }
        return iArr2;
    }

    private static int ˋ(TrackGroup trackGroup, int[] iArr, e eVar) {
        int i = 0;
        int i2 = 0;
        while (i < trackGroup.ॱ) {
            if (ˊ(trackGroup.ˊ(i), iArr[i], eVar)) {
                i2++;
            }
            i++;
        }
        return i2;
    }

    private static boolean ˊ(Format format, int i, e eVar) {
        if (!ˏ(i, false) || format.ॱˎ != eVar.ˎ || format.ʼॱ != eVar.ॱ) {
            return false;
        }
        if (eVar.ˊ == null || TextUtils.equals(eVar.ˊ, format.ʽ)) {
            return true;
        }
        return false;
    }

    @Nullable
    protected Pair<akz, Integer> ˋ(TrackGroupArray trackGroupArray, int[][] iArr, Parameters parameters) throws ExoPlaybackException {
        TrackGroup trackGroup = null;
        int i = 0;
        int i2 = 0;
        for (int i3 = 0; i3 < trackGroupArray.ॱ; i3++) {
            TrackGroup ˋ = trackGroupArray.ˋ(i3);
            int[] iArr2 = iArr[i3];
            int i4 = 0;
            while (i4 < ˋ.ॱ) {
                int i5;
                TrackGroup trackGroup2;
                if (ˏ(iArr2[i4], parameters.ᐝॱ)) {
                    Format ˊ = ˋ.ˊ(i4);
                    int i6 = ˊ.ʾ & (parameters.ˎ ^ -1);
                    Object obj = (i6 & 1) != 0 ? 1 : null;
                    Object obj2 = (i6 & 2) != 0 ? 1 : null;
                    boolean ˋ2 = ˋ(ˊ, parameters.ˏ);
                    if (ˋ2 || (parameters.ˊ && ˋ(ˊ))) {
                        int i7;
                        if (obj != null) {
                            i7 = 8;
                        } else if (obj2 == null) {
                            i7 = 6;
                        } else {
                            i7 = 4;
                        }
                        if (ˋ2) {
                            i5 = 1;
                        } else {
                            i5 = 0;
                        }
                        i5 += i7;
                    } else if (obj != null) {
                        i5 = 3;
                    } else if (obj2 != null) {
                        if (ˋ(ˊ, parameters.ॱ)) {
                            i5 = 2;
                        } else {
                            i5 = 1;
                        }
                    }
                    if (ˏ(iArr2[i4], false)) {
                        i5 += 1000;
                    }
                    if (i5 > i2) {
                        i2 = i5;
                        trackGroup2 = ˋ;
                        i5 = i4;
                        i4++;
                        trackGroup = trackGroup2;
                        i = i5;
                    }
                }
                i5 = i;
                trackGroup2 = trackGroup;
                i4++;
                trackGroup = trackGroup2;
                i = i5;
            }
        }
        if (trackGroup == null) {
            return null;
        }
        return Pair.create(new akv(trackGroup, i), Integer.valueOf(i2));
    }

    @Nullable
    protected akz ॱ(int i, TrackGroupArray trackGroupArray, int[][] iArr, Parameters parameters) throws ExoPlaybackException {
        TrackGroup trackGroup = null;
        int i2 = 0;
        int i3 = 0;
        for (int i4 = 0; i4 < trackGroupArray.ॱ; i4++) {
            TrackGroup ˋ = trackGroupArray.ˋ(i4);
            int[] iArr2 = iArr[i4];
            int i5 = 0;
            while (i5 < ˋ.ॱ) {
                int i6;
                TrackGroup trackGroup2;
                if (ˏ(iArr2[i5], parameters.ᐝॱ)) {
                    i6 = ((ˋ.ˊ(i5).ʾ & 1) != 0 ? 1 : null) != null ? 2 : 1;
                    if (ˏ(iArr2[i5], false)) {
                        i6 += 1000;
                    }
                    if (i6 > i3) {
                        i3 = i5;
                        trackGroup2 = ˋ;
                        i5++;
                        trackGroup = trackGroup2;
                        i2 = i3;
                        i3 = i6;
                    }
                }
                i6 = i3;
                i3 = i2;
                trackGroup2 = trackGroup;
                i5++;
                trackGroup = trackGroup2;
                i2 = i3;
                i3 = i6;
            }
        }
        return trackGroup == null ? null : new akv(trackGroup, i2);
    }

    private static void ˊ(o.aks.e eVar, int[][][] iArr, abs[] o_absArr, akz[] o_akzArr, int i) {
        int i2 = 0;
        if (i != 0) {
            int i3 = 0;
            int i4 = -1;
            int i5 = -1;
            while (i3 < eVar.ˊ()) {
                int ˏ = eVar.ˏ(i3);
                akz o_akz = o_akzArr[i3];
                if ((ˏ == 1 || ˏ == 2) && o_akz != null && ˏ(iArr[i3], eVar.ॱ(i3), o_akz)) {
                    if (ˏ == 1) {
                        if (i5 != -1) {
                            i3 = 0;
                            break;
                        }
                        i5 = i3;
                    } else if (i4 != -1) {
                        i3 = 0;
                        break;
                    } else {
                        i4 = i3;
                    }
                }
                i3++;
            }
            i3 = 1;
            if (!(i5 == -1 || i4 == -1)) {
                i2 = 1;
            }
            if ((i3 & i2) != 0) {
                abs o_abs = new abs(i);
                o_absArr[i5] = o_abs;
                o_absArr[i4] = o_abs;
            }
        }
    }

    private static boolean ˏ(int[][] iArr, TrackGroupArray trackGroupArray, akz o_akz) {
        if (o_akz == null) {
            return false;
        }
        int ˋ = trackGroupArray.ˋ(o_akz.ˊ());
        for (int i = 0; i < o_akz.ॱ(); i++) {
            if ((iArr[ˋ][o_akz.ˊ(i)] & 32) != 32) {
                return false;
            }
        }
        return true;
    }

    private static int ˎ(int i, int i2) {
        return i == -1 ? i2 == -1 ? 0 : -1 : i2 == -1 ? 1 : i - i2;
    }

    protected static boolean ˏ(int i, boolean z) {
        int i2 = i & 7;
        return i2 == 4 || (z && i2 == 3);
    }

    protected static boolean ˋ(Format format) {
        return TextUtils.isEmpty(format.ˋˊ) || ˋ(format, "und");
    }

    protected static boolean ˋ(Format format, @Nullable String str) {
        return str != null && TextUtils.equals(str, anr.ˋ(format.ˋˊ));
    }

    private static List<Integer> ॱ(TrackGroup trackGroup, int i, int i2, boolean z) {
        int i3;
        int i4 = 0;
        ArrayList arrayList = new ArrayList(trackGroup.ॱ);
        for (i3 = 0; i3 < trackGroup.ॱ; i3++) {
            arrayList.add(Integer.valueOf(i3));
        }
        if (i == ActivityChooserViewAdapter.MAX_ACTIVITY_COUNT_UNLIMITED || i2 == ActivityChooserViewAdapter.MAX_ACTIVITY_COUNT_UNLIMITED) {
            return arrayList;
        }
        int i5 = Integer.MAX_VALUE;
        while (i4 < trackGroup.ॱ) {
            Format ˊ = trackGroup.ˊ(i4);
            if (ˊ.ͺ > 0 && ˊ.ˏॱ > 0) {
                Point ˏ = ˏ(z, i, i2, ˊ.ͺ, ˊ.ˏॱ);
                i3 = ˊ.ͺ * ˊ.ˏॱ;
                if (ˊ.ͺ >= ((int) (((float) ˏ.x) * 0.98f)) && ˊ.ˏॱ >= ((int) (((float) ˏ.y) * 0.98f)) && i3 < i5) {
                    i4++;
                    i5 = i3;
                }
            }
            i3 = i5;
            i4++;
            i5 = i3;
        }
        if (i5 != Integer.MAX_VALUE) {
            for (i4 = arrayList.size() - 1; i4 >= 0; i4--) {
                i3 = trackGroup.ˊ(((Integer) arrayList.get(i4)).intValue()).ˊ();
                if (i3 == -1 || i3 > i5) {
                    arrayList.remove(i4);
                }
            }
        }
        return arrayList;
    }

    private static Point ˏ(boolean z, int i, int i2, int i3, int i4) {
        Object obj = 1;
        if (z) {
            Object obj2 = i3 > i4 ? 1 : null;
            if (i <= i2) {
                obj = null;
            }
            if (obj2 != obj) {
                int i5 = i;
                i = i2;
                i2 = i5;
            }
        }
        if (i3 * i2 >= i4 * i) {
            return new Point(i, anr.ˎ(i * i4, i3));
        }
        return new Point(anr.ˎ(i2 * i3, i4), i2);
    }

    private static int ˊ(int i, int i2) {
        if (i > i2) {
            return 1;
        }
        return i2 > i ? -1 : 0;
    }
}
